home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / Drawing / Drawing-2 / Drawing.text < prev    next >
Encoding:
Text File  |  1994-02-28  |  3.2 KB  |  110 lines  |  [TEXT/MPS ]

  1. // Copyright ©1993-94 Apple Computer, Inc. All rights reserved.
  2. constant kAppSymbol := '|Drawing:PIEDTS|;
  3. // ---- End Project Data ----
  4.  
  5.  
  6. // ---- File Draw.t ----
  7. _view000 :=
  8.    {title: "Drawing Examples",
  9.     viewBounds: {left: -1, top: 0, right: 236, bottom: 325},
  10.     viewDrawScript:
  11.       func()
  12.       begin
  13.           :DrawMe();    // just draw all the shapes
  14.       end,
  15.     myLine: nil,
  16.     myRect: nil,
  17.     myRoundRect: nil,
  18.     myOval: nil,
  19.     myWedge: nil
  20.     ,
  21.     myPolygon: nil,
  22.     myShape: nil,
  23.     myRegion: nil,
  24.     myPict: nil,
  25.     myText: nil,
  26.     myScaledPict: nil,
  27.     myStyle: nil,
  28.     DrawMe:
  29.       func()
  30.       begin
  31.       /*    There are two ways to pass shapes to DrawShape, either
  32.           individual shape objects, or all of them inside an Array.
  33.           We show both techniques in this sample.
  34.           
  35.           :DrawShape(myLine, myStyle);
  36.           :DrawShape(myRect, myStyle);
  37.           :DrawShape(myRoundRect, myStyle);
  38.           :DrawShape(myOval, myStyle);
  39.           :DrawShape(myWedge, myStyle);
  40.           :DrawShape(myPolygon, myStyle);
  41.           :DrawShape(myRegion, myStyle);
  42.           :DrawShape(myPict, myStyle);
  43.           :DrawShape(myText, myStyle);
  44.           :DrawShape(myScaledPict, myStyle);
  45.       */
  46.           :DrawShape([myLine, myRect, myRoundRect, myOval, myWedge,
  47.                           myPolygon, myRegion, myPict, myText, myScaledPict],
  48.                           myStyle);
  49.           
  50.       end,
  51.     viewSetupDoneScript:
  52.       func()
  53.       begin
  54.           // Create all the example shape objects.
  55.           myLine := MakeLine(0,0, 20, 20);
  56.           myRect := MakeRect(0,30,20,50);
  57.           myRoundRect := MakeRoundRect(0, 60, 20, 80, 10);
  58.           myOval := MakeOval(0, 90, 20, 110);
  59.           myWedge := MakeWedge(0, 120, 20, 140, 0, 90);
  60.           myPolygon := MakePolygon([0, 150, 20, 170, 20, 150]);
  61.       
  62.           local rectangle := MakeRect(0, 210, 30, 230);
  63.           local oval := MakeOval(0, 220, 30, 240);
  64.           myRegion := MakeRegion([rectangle, oval,]);
  65.           myText := MakeText("Bob", 0, 250, 55, 270);
  66.           myPict := MakePict([myLine, myRect, myRoundRect, myOval, myWedge, 
  67.                                       myPolygon, myRegion, myText], myStyle);
  68.                                       
  69.           // Do the PICT thing, adjust the PICT resource to the pict shape object.
  70.           OffsetShape(myPict, 40, 5);
  71.           myScaledPict := DeepClone(myPict);
  72.           local startRect := ShapeBounds(myScaledPict);
  73.           local endRect := {left: 80, top: 10, right: 150, bottom: 150,};
  74.           ScaleShape(myScaledPict, startRect, endRect);
  75.       end,
  76.     viewSetupFormScript:
  77.       func()
  78.       begin
  79.           local a := GetAppParams();
  80.          self.viewBounds := RelBounds(a.appAreaLeft, a.appAreaTop, a.appAreaWidth, a.appAreaHeight);
  81.       end,
  82.     _proto: protoApp
  83.    };
  84.  
  85. _view001 := /* child of _view000 */
  86.    {viewFlags: 545,
  87.     viewFormat: 0,
  88.     viewBounds: {left: 122, top: 18, right: 234, bottom: 138},
  89.     viewClickScript:
  90.       func(unit)
  91.       begin
  92.           // We will lock the screen, do the drawing, and unlock
  93.           // the screen.
  94.           :LockScreen(true);
  95.           :DoDrawing('DrawMe, nil);
  96.           // :DrawMe();    // Don't do it this way, won't set up clipping etc.
  97.           :LockScreen(nil);
  98.       end,
  99.     viewclass: 74
  100.    };
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. // ---- Beginning of section for non used Layout files ----
  109.  
  110. // End of output